package com.fis.hlo.pm.persistence;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;

/**
 * <p>
 * Java class for cycles complex type.
 * 
 * <p>
 * The following schema fragment specifies the expected content contained within
 * this class.
 * 
 * <pre>
 * &lt;complexType name="cycles">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="cycleId" type="{http://www.w3.org/2001/XMLSchema}long"/>
 *         &lt;element name="cycleTypeId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         &lt;element name="fromDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         &lt;element name="month" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         &lt;element name="toDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "cycles", propOrder = { "cycleId", "cycleTypeId", "fromDate",
		"month", "toDate" })
public class Cycles {

	protected long cycleId;
	protected Long cycleTypeId;
	@XmlSchemaType(name = "dateTime")
	protected Date fromDate;
	@XmlSchemaType(name = "dateTime")
	protected Date month;
	@XmlSchemaType(name = "dateTime")
	protected Date toDate;

	/**
	 * Gets the value of the cycleId property.
	 * 
	 */
	public long getCycleId() {
		return cycleId;
	}

	/**
	 * Sets the value of the cycleId property.
	 * 
	 */
	public void setCycleId(long value) {
		this.cycleId = value;
	}

	/**
	 * Gets the value of the cycleTypeId property.
	 * 
	 * @return possible object is {@link Long }
	 * 
	 */
	public Long getCycleTypeId() {
		return cycleTypeId;
	}

	/**
	 * Sets the value of the cycleTypeId property.
	 * 
	 * @param value
	 *            allowed object is {@link Long }
	 * 
	 */
	public void setCycleTypeId(Long value) {
		this.cycleTypeId = value;
	}

	/**
	 * Gets the value of the fromDate property.
	 * 
	 * @return possible object is {@link XMLGregorianCalendar }
	 * 
	 */
	public Date getFromDate() {
		return fromDate;
	}

	/**
	 * Sets the value of the fromDate property.
	 * 
	 * @param value
	 *            allowed object is {@link XMLGregorianCalendar }
	 * 
	 */
	public void setFromDate(Date value) {
		this.fromDate = value;
	}

	/**
	 * Gets the value of the month property.
	 * 
	 * @return possible object is {@link XMLGregorianCalendar }
	 * 
	 */
	public Date getMonth() {
		return month;
	}

	/**
	 * Sets the value of the month property.
	 * 
	 * @param value
	 *            allowed object is {@link XMLGregorianCalendar }
	 * 
	 */
	public void setMonth(Date value) {
		this.month = value;
	}

	/**
	 * Gets the value of the toDate property.
	 * 
	 * @return possible object is {@link XMLGregorianCalendar }
	 * 
	 */
	public Date getToDate() {
		return toDate;
	}

	/**
	 * Sets the value of the toDate property.
	 * 
	 * @param value
	 *            allowed object is {@link XMLGregorianCalendar }
	 * 
	 */
	public void setToDate(Date value) {
		this.toDate = value;
	}

	public String toString() {

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		return sdf.format(fromDate) + " -> " + sdf.format(toDate);

	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Cycles) {
			Cycles c = (Cycles) obj;
			return ((Cycles) obj).getCycleId() == cycleId;
		}

		return false;
	}

}
